﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MapData {

    /// <summary>
    /// An object which represents a point in a mapping system
    /// </summary>
    public class Point : MapObject {

        private SimplePoint point;

        private string iconType;
        private string iconColor;
        private float iconScale;

        private string labelColor;
        private float labelScale;


        /// <summary>
        /// pre:A SimplePoint needs to be created and passed to the function
        /// post: Creates a Point object with default values.
        /// </summary>
        /// <param name="value"></param>
        public Point(SimplePoint value) : base() {
            this.point = value;
            iconType = "http://maps.google.com/mapfiles/kml/paddle/wht-blank.png";
            iconColor = "000000";
            labelColor = "000000";
            iconScale = 100;
            labelScale = 100;
        }

        /// <summary>
        /// pre:
        /// post: Sets the icon url for the icon.
        /// </summary>
        public string IconType {
            get {
                return this.iconType;
            }
            set {
                if (value.StartsWith("http://maps.google.com/mapfiles/kml/paddle/")) {
                    this.iconType = value;
                }
                else
                    this.iconType = "http://maps.google.com/mapfiles/kml/paddle/" + value;
            }
        }

        /// <summary>
        /// pre:
        /// post: Returns or sets the value of the icon's color
        /// </summary>
        public string IconColor {
            get {
                return this.iconColor;
            }
            set {
                iconColor = value;
            }
        }

        /// <summary>
        /// pre:
        /// post: Returns or sets the scale value of the Point's icon
        /// </summary>
        public float IconScale {
            get {
                return this.iconScale;
            }
            set {
                iconScale = value;
            }
        }

        /// <summary>
        /// pre:
        /// post:Returns or sets the color of the Point's Label
        /// </summary>
        public string LabelColor {
            get {
                return this.labelColor;
            }
            set {
                labelColor = value;
            }
        }

        /// <summary>
        /// pre:
        /// post: Returns or sets the scale value of the Point's Label
        /// </summary>
        public float LabelScale {
            get {
                return this.labelScale;
            }
            set {
                labelScale = value;
            }
        }

        /// <summary>
        /// pre:
        /// post: Returns or sets the x coordinate of the point
        /// </summary>
        public double X {
            set {
                point.X = value;
            }
            get { return point.X; }
        }

        /// <summary>
        /// pre:
        /// post: Returns or sets the y coordinate of the point.
        /// </summary>
        public double Y {
            set {
                point.Y = value;
            }
            get { return point.Y; }
        }
        
        /// <summary>
        /// pre:
        /// post: Returns the point as a string.
        /// </summary>
        /// <returns></returns>
        public override string ToString() {
            return (point.ToString());
        }
    }
}
